﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Core.DataAccess.Model.Migrations.ProjectEntrepot
{
    public partial class addtypeicon : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "ICON",
                table: "product_type",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "ReadNumber",
                table: "product_template",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "SalesNumber",
                table: "product_template",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "ProductAttrbute",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ProductId = table.Column<int>(nullable: false),
                    ProductCount = table.Column<int>(nullable: false),
                    ReadCount = table.Column<int>(nullable: false),
                    SalesVolume = table.Column<int>(nullable: false),
                    Type = table.Column<int>(nullable: false),
                    StartTime = table.Column<DateTime>(nullable: false),
                    EndTime = table.Column<DateTime>(nullable: false),
                    Content = table.Column<string>(nullable: true),
                    ProjectToken = table.Column<string>(nullable: true),
                    RegTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductAttrbute", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ProductAttrbute");

            migrationBuilder.DropColumn(
                name: "ICON",
                table: "product_type");

            migrationBuilder.DropColumn(
                name: "ReadNumber",
                table: "product_template");

            migrationBuilder.DropColumn(
                name: "SalesNumber",
                table: "product_template");
        }
    }
}
